home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gbusters.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  15KB  |  463 lines

  1. /***************************************************************************
  2.  
  3. Gangbusters(GX878) (c) 1988 Konami
  4.  
  5. Preliminary driver by:
  6.     Manuel Abadia <manu@teleline.es>
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11. #include "vidhrdw/generic.h"
  12. #include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
  13. #include "vidhrdw/konamiic.h"
  14.  
  15. /* prototypes */
  16. static void gbusters_init_machine( void );
  17. static void gbusters_banking( int lines );
  18.  
  19.  
  20. extern int gbusters_priority;
  21.  
  22. void gbusters_vh_stop( void );
  23. int gbusters_vh_start( void );
  24. void gbusters_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  25.  
  26. static int palette_selected;
  27. static unsigned char *ram;
  28.  
  29. static int gbusters_interrupt( void )
  30. {
  31.     if (K052109_is_IRQ_enabled())
  32.         return KONAMI_INT_IRQ;
  33.     else
  34.         return ignore_interrupt();
  35. }
  36.  
  37. static READ_HANDLER( bankedram_r )
  38. {
  39.     if (palette_selected)
  40.         return paletteram_r(offset);
  41.     else
  42.         return ram[offset];
  43. }
  44.  
  45. static WRITE_HANDLER( bankedram_w )
  46. {
  47.     if (palette_selected)
  48.         paletteram_xBBBBBGGGGGRRRRR_swap_w(offset,data);
  49.     else
  50.         ram[offset] = data;
  51. }
  52.  
  53. static WRITE_HANDLER( gbusters_1f98_w )
  54. {
  55.  
  56.     /* bit 0 = enable char ROM reading through the video RAM */
  57.     K052109_set_RMRD_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
  58.  
  59.     /* bit 7 used (during gfx rom tests), but unknown */
  60.  
  61.     /* other bits unused/unknown */
  62.     if (data & 0xfe){
  63.         //logerror("%04x: (1f98) write %02x\n",cpu_get_pc(), data);
  64.         //usrintf_showmessage("$1f98 = %02x", data);
  65.     }
  66. }
  67.  
  68. static WRITE_HANDLER( gbusters_coin_counter_w )
  69. {
  70.     /* bit 0 select palette RAM  or work RAM at 5800-5fff */
  71.     palette_selected = ~data & 0x01;
  72.  
  73.     /* bits 1 & 2 = coin counters */
  74.     coin_counter_w(0,data & 0x02);
  75.     coin_counter_w(1,data & 0x04);
  76.  
  77.     /* bits 3 selects tilemap priority */
  78.     gbusters_priority = data & 0x08;
  79.  
  80.     /* bit 7 is used but unknown */
  81.  
  82.     /* other bits unused/unknown */
  83.     if (data & 0xf8)
  84.     {
  85.         char baf[40];
  86.         logerror("%04x: (ccount) write %02x\n",cpu_get_pc(), data);
  87.         sprintf(baf,"ccnt = %02x", data);
  88. //        usrintf_showmessage(baf);
  89.     }
  90. }
  91.  
  92. static WRITE_HANDLER( gbusters_unknown_w )
  93. {
  94.     logerror("%04x: (???) write %02x\n",cpu_get_pc(), data);
  95.  
  96. {
  97. char baf[40];
  98.     sprintf(baf,"??? = %02x", data);
  99. //    usrintf_showmessage(baf);
  100. }
  101. }
  102.  
  103. WRITE_HANDLER( gbusters_sh_irqtrigger_w )
  104. {
  105.     cpu_cause_interrupt(1,0xff);
  106. }
  107.  
  108. static WRITE_HANDLER( gbusters_snd_bankswitch_w )
  109. {
  110.     unsigned char *RAM = memory_region(REGION_SOUND1);
  111.  
  112.     int bank_B = 0x20000*((data >> 2) & 0x01);    /* ?? */
  113.     int bank_A = 0x20000*((data) & 0x01);        /* ?? */
  114.  
  115.     K007232_bankswitch(0,RAM + bank_A,RAM + bank_B);
  116.  
  117. #if 0
  118.     {
  119.         char baf[40];
  120.         sprintf(baf,"snd_bankswitch = %02x", data);
  121.         usrintf_showmessage(baf);
  122.     }
  123. #endif
  124. }
  125.  
  126. static struct MemoryReadAddress gbusters_readmem[] =
  127. {
  128.     { 0x1f90, 0x1f90, input_port_3_r },        /* coinsw & startsw */
  129.     { 0x1f91, 0x1f91, input_port_4_r },        /* Player 1 inputs */
  130.     { 0x1f92, 0x1f92, input_port_5_r },        /* Player 2 inputs */
  131.     { 0x1f93, 0x1f93, input_port_2_r },        /* DIPSW #3 */
  132.     { 0x1f94, 0x1f94, input_port_0_r },        /* DIPSW #1 */
  133.     { 0x1f95, 0x1f95, input_port_1_r },        /* DIPSW #2 */
  134.     { 0x0000, 0x3fff, K052109_051960_r },    /* tiles + sprites (RAM H21, G21 & H6) */
  135.     { 0x4000, 0x57ff, MRA_RAM },            /* RAM I12 */
  136.     { 0x5800, 0x5fff, bankedram_r },        /* palette + work RAM (RAM D16 & C16) */
  137.     { 0x6000, 0x7fff, MRA_BANK1 },            /* banked ROM */
  138.     { 0x8000, 0xffff, MRA_ROM },            /* ROM 878n02.rom */
  139.     { -1 }    /* end of table */
  140. };
  141.  
  142. static struct MemoryWriteAddress gbusters_writemem[] =
  143. {
  144.     { 0x1f80, 0x1f80, gbusters_coin_counter_w },    /* coin counters */
  145.     { 0x1f84, 0x1f84, soundlatch_w },                /* sound code # */
  146.     { 0x1f88, 0x1f88, gbusters_sh_irqtrigger_w },    /* cause interrupt on audio CPU */
  147.     { 0x1f8c, 0x1f8c, watchdog_reset_w },            /* watchdog reset */
  148.     { 0x1f98, 0x1f98, gbusters_1f98_w },            /* enable gfx ROM read through VRAM */
  149.     { 0x1f9c, 0x1f9c, gbusters_unknown_w },            /* ??? */
  150.     { 0x0000, 0x3fff, K052109_051960_w },            /* tiles + sprites (RAM H21, G21 & H6) */
  151.     { 0x4000, 0x57ff, MWA_RAM },                    /* RAM I12 */
  152.     { 0x5800, 0x5fff, bankedram_w, &ram },            /* palette + work RAM (RAM D16 & C16) */
  153.     { 0x6000, 0x7fff, MWA_ROM },                    /* banked ROM */
  154.     { 0x8000, 0xffff, MWA_ROM },                    /* ROM 878n02.rom */
  155.     { -1 }    /* end of table */
  156. };
  157.  
  158. static struct MemoryReadAddress gbusters_readmem_sound[] =
  159. {
  160.     { 0x0000, 0x7fff, MRA_ROM },                /* ROM 878h01.rom */
  161.     { 0x8000, 0x87ff, MRA_RAM },                /* RAM */
  162.     { 0xa000, 0xa000, soundlatch_r },            /* soundlatch_r */
  163.     { 0xb000, 0xb00d, K007232_read_port_0_r },    /* 007232 registers */
  164.     { 0xc001, 0xc001, YM2151_status_port_0_r },    /* YM 2151 */
  165.     { -1 }    /* end of table */
  166. };
  167.  
  168. static struct MemoryWriteAddress gbusters_writemem_sound[] =
  169. {
  170.     { 0x0000, 0x7fff, MWA_ROM },                    /* ROM 878h01.rom */
  171.     { 0x8000, 0x87ff, MWA_RAM },                    /* RAM */
  172.     { 0xb000, 0xb00d, K007232_write_port_0_w },        /* 007232 registers */
  173.     { 0xc000, 0xc000, YM2151_register_port_0_w },    /* YM 2151 */
  174.     { 0xc001, 0xc001, YM2151_data_port_0_w },        /* YM 2151 */
  175.     { 0xf000, 0xf000, gbusters_snd_bankswitch_w },    /* 007232 bankswitch? */
  176.     { -1 }    /* end of table */
  177. };
  178.  
  179. /***************************************************************************
  180.  
  181.     Input Ports
  182.  
  183. ***************************************************************************/
  184.  
  185. INPUT_PORTS_START( gbusters )
  186.     PORT_START    /* DSW #1 */
  187.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  188.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  189.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  190.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  191.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  192.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  193.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  194.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  195.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  196.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  197.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  198.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  199.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  200.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  201.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  202.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  203.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  204.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  205.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  206.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  207.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  208.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  209.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  210.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  211.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  212.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  213.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  214.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  215.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  216.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  217.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  218.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  219.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  220. //    PORT_DIPSETTING(    0x00, "Invalid" )
  221.  
  222.     PORT_START    /* DSW #2 */
  223.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  224.     PORT_DIPSETTING(    0x03, "2" )
  225.     PORT_DIPSETTING(    0x02, "3" )
  226.     PORT_DIPSETTING(    0x01, "5" )
  227.     PORT_DIPSETTING(    0x00, "7" )
  228.     PORT_DIPNAME( 0x04, 0x04, "Bullets" )
  229.     PORT_DIPSETTING(    0x04, "50" )
  230.     PORT_DIPSETTING(    0x00, "60" )
  231.     PORT_DIPNAME( 0x18, 0x10, DEF_STR( Bonus_Life ) )
  232.     PORT_DIPSETTING(    0x18, "50k, 200k & 400k" )
  233.     PORT_DIPSETTING(    0x10, "70k, 250k & 500k" )
  234.     PORT_DIPSETTING(    0x08, "50k" )
  235.     PORT_DIPSETTING(    0x00, "70k" )
  236.     PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
  237.     PORT_DIPSETTING(    0x60, "Easy" )
  238.     PORT_DIPSETTING(    0x40, "Normal" )
  239.     PORT_DIPSETTING(    0x20, "Difficult" )
  240.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  241.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  242.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  243.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  244.  
  245.     PORT_START    /* DSW #3 */
  246.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  247.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  248.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  249.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  250.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  251.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  252.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  253.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  254.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  255.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  256.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  257.  
  258.     PORT_START    /* COINSW */
  259.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  260.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  261.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  262.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  263.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  264.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  265.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  266.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  267.  
  268.     PORT_START    /* PLAYER 1 INPUTS */
  269.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
  270.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  271.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
  272.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
  273.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  274.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  275.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  276.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  277.  
  278.     PORT_START    /* PLAYER 2 INPUTS */
  279.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  280.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  281.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  282.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  283.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  284.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  285.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  286.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  287.  
  288. INPUT_PORTS_END
  289.  
  290.  
  291. /***************************************************************************
  292.  
  293.     Machine Driver
  294.  
  295. ***************************************************************************/
  296.  
  297. static void volume_callback(int v)
  298. {
  299.     K007232_set_volume(0,0,(v >> 4) * 0x11,0);
  300.     K007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
  301. }
  302.  
  303. static struct K007232_interface k007232_interface =
  304. {
  305.     1,        /* number of chips */
  306.     { REGION_SOUND1 },    /* memory regions */
  307.     { K007232_VOL(30,MIXER_PAN_CENTER,30,MIXER_PAN_CENTER) },    /* volume */
  308.     { volume_callback }    /* external port callback */
  309. };
  310.  
  311. static struct YM2151interface ym2151_interface =
  312. {
  313.     1, /* 1 chip */
  314.     3579545, /* 3.579545 MHz */
  315.     { YM3012_VOL(60,MIXER_PAN_LEFT,60,MIXER_PAN_RIGHT) },
  316.     { 0 },
  317.     { 0 }
  318. };
  319.  
  320. static struct MachineDriver machine_driver_gbusters =
  321. {
  322.     /* basic machine hardware */
  323.     {
  324.         {
  325.             CPU_KONAMI,        /* Konami custom 052526 */
  326.             3000000,        /* ? */
  327.             gbusters_readmem,gbusters_writemem,0,0,
  328.             gbusters_interrupt,1
  329.         },
  330.         {
  331.             CPU_Z80 | CPU_AUDIO_CPU,
  332.             3579545,        /* ? */
  333.             gbusters_readmem_sound, gbusters_writemem_sound,0,0,
  334.             ignore_interrupt,0    /* interrupts are triggered by the main CPU */
  335.         }
  336.     },
  337.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  338.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  339.     gbusters_init_machine,
  340.  
  341.     /* video hardware */
  342.     64*8, 32*8, { 14*8, (64-14)*8-1, 2*8, 30*8-1 },
  343.     0,    /* gfx decoded by konamiic.c */
  344.     1024, 1024,
  345.     0,
  346.  
  347.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  348.     0,
  349.     gbusters_vh_start,
  350.     gbusters_vh_stop,
  351.     gbusters_vh_screenrefresh,
  352.  
  353.     /* sound hardware */
  354.     0,0,0,0,
  355.     {
  356.         {
  357.             SOUND_YM2151,
  358.             &ym2151_interface
  359.         },
  360.         {
  361.             SOUND_K007232,
  362.             &k007232_interface
  363.         }
  364.     }
  365. };
  366.  
  367.  
  368. /***************************************************************************
  369.  
  370.   Game ROMs
  371.  
  372. ***************************************************************************/
  373.  
  374. ROM_START( gbusters )
  375.     ROM_REGION( 0x30800, REGION_CPU1 ) /* code + banked roms + space for banked RAM */
  376.     ROM_LOAD( "878n02.rom", 0x10000, 0x08000, 0x51697aaa )    /* ROM K13 */
  377.     ROM_CONTINUE(           0x08000, 0x08000 )
  378.     ROM_LOAD( "878j03.rom", 0x20000, 0x10000, 0x3943a065 )    /* ROM K15 */
  379.  
  380.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for the sound CPU */
  381.     ROM_LOAD( "878h01.rom", 0x00000, 0x08000, 0x96feafaa )
  382.  
  383.     ROM_REGION( 0x80000, REGION_GFX1 ) /* graphics (addressable by the main CPU) */
  384.     ROM_LOAD( "878c07.rom", 0x00000, 0x40000, 0xeeed912c )    /* tiles */
  385.     ROM_LOAD( "878c08.rom", 0x40000, 0x40000, 0x4d14626d )    /* tiles */
  386.  
  387.     ROM_REGION( 0x80000, REGION_GFX2 ) /* graphics (addressable by the main CPU) */
  388.     ROM_LOAD( "878c05.rom", 0x00000, 0x40000, 0x01f4aea5 )    /* sprites */
  389.     ROM_LOAD( "878c06.rom", 0x40000, 0x40000, 0xedfaaaaf )    /* sprites */
  390.  
  391.     ROM_REGION( 0x0100, REGION_PROMS )
  392.     ROM_LOAD( "878a09.rom",   0x0000, 0x0100, 0xe2d09a1b )    /* priority encoder (not used) */
  393.  
  394.     ROM_REGION( 0x40000, REGION_SOUND1 ) /* samples for 007232 */
  395.     ROM_LOAD( "878c04.rom",  0x00000, 0x40000, 0x9e982d1c )
  396. ROM_END
  397.  
  398. ROM_START( crazycop )
  399.     ROM_REGION( 0x30800, REGION_CPU1 ) /* code + banked roms + space for banked RAM */
  400.     ROM_LOAD( "878m02.bin", 0x10000, 0x08000, 0x9c1c9f52 )    /* ROM K13 */
  401.     ROM_CONTINUE(           0x08000, 0x08000 )
  402.     ROM_LOAD( "878j03.rom", 0x20000, 0x10000, 0x3943a065 )    /* ROM K15 */
  403.  
  404.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for the sound CPU */
  405.     ROM_LOAD( "878h01.rom", 0x00000, 0x08000, 0x96feafaa )
  406.  
  407.     ROM_REGION( 0x80000, REGION_GFX1 ) /* graphics (addressable by the main CPU) */
  408.     ROM_LOAD( "878c07.rom", 0x00000, 0x40000, 0xeeed912c )    /* tiles */
  409.     ROM_LOAD( "878c08.rom", 0x40000, 0x40000, 0x4d14626d )    /* tiles */
  410.  
  411.     ROM_REGION( 0x80000, REGION_GFX2 ) /* graphics (addressable by the main CPU) */
  412.     ROM_LOAD( "878c05.rom", 0x00000, 0x40000, 0x01f4aea5 )    /* sprites */
  413.     ROM_LOAD( "878c06.rom", 0x40000, 0x40000, 0xedfaaaaf )    /* sprites */
  414.  
  415.     ROM_REGION( 0x0100, REGION_PROMS )
  416.     ROM_LOAD( "878a09.rom",   0x0000, 0x0100, 0xe2d09a1b )    /* priority encoder (not used) */
  417.  
  418.     ROM_REGION( 0x40000, REGION_SOUND1 ) /* samples for 007232 */
  419.     ROM_LOAD( "878c04.rom",  0x00000, 0x40000, 0x9e982d1c )
  420. ROM_END
  421.  
  422.  
  423. static void gbusters_banking( int lines )
  424. {
  425.     unsigned char *RAM = memory_region(REGION_CPU1);
  426.     int offs = 0x10000;
  427.  
  428.     /* bits 0-3 ROM bank */
  429.     offs += (lines & 0x0f)*0x2000;
  430.     cpu_setbank( 1, &RAM[offs] );
  431.  
  432.     if (lines & 0xf0){
  433.         //logerror("%04x: (lines) write %02x\n",cpu_get_pc(), lines);
  434.         //usrintf_showmessage("lines = %02x", lines);
  435.     }
  436.  
  437.     /* other bits unknown */
  438. }
  439.  
  440. static void gbusters_init_machine( void )
  441. {
  442.     unsigned char *RAM = memory_region(REGION_CPU1);
  443.  
  444.     konami_cpu_setlines_callback = gbusters_banking;
  445.  
  446.     /* mirror address for banked ROM */
  447.     memcpy(&RAM[0x18000], &RAM[0x10000], 0x08000 );
  448.  
  449.     paletteram = &RAM[0x30000];
  450. }
  451.  
  452.  
  453. static void init_gbusters(void)
  454. {
  455.     konami_rom_deinterleave_2(REGION_GFX1);
  456.     konami_rom_deinterleave_2(REGION_GFX2);
  457. }
  458.  
  459.  
  460.  
  461. GAME( 1988, gbusters, 0,        gbusters, gbusters, gbusters, ROT90, "Konami", "Gang Busters" )
  462. GAME( 1988, crazycop, gbusters, gbusters, gbusters, gbusters, ROT90, "Konami", "Crazy Cop (Japan)" )
  463.